package com.toefl.speaking.activity;

import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.toefl.speaking.R;
import com.toefl.speaking.handler.AuthHandler;
import com.toefl.speaking.handler.AuthHandler.Auth;

public class testCommuniteActivity extends Activity {

	private Activity thiz;
	private ProgressDialog progressDialog;
	private Button authButton;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.data_test);
		thiz = this;
		authButton = (Button) findViewById(R.id.auth);
		NavigationButtonsOnClickListener listener = new NavigationButtonsOnClickListener();
		authButton.setOnClickListener(listener);
	}

	private class NavigationButtonsOnClickListener implements View.OnClickListener {

		@Override
		public void onClick(View v) {
			// resetNavigationBarButtons();
			switch (v.getId()) {
			case R.id.auth:
				// ProgressDialog.show(thiz, "等待", "==");
				// progressDialog.show();
				new Thread(new PostQuestionRunnable()).start();
				break;
			// case R.id.buttonHealthNotice:
			// break;
			// case R.id.buttonMore:
			// break;
			}
		}
	}

	private class PostQuestionRunnable implements Runnable {

		@Override
		public void run() {
			try {
				Auth auth = AuthHandler.instance().getAuth();
				auth.setDeviceToken("123123123123");
				String result = AuthHandler.instance().postAuth(auth, thiz);
				// Question question = QuestionHandler.instance().getQuestion();
				// question.setTitle(title);
				// question.setContents(contents);
				// question.setName(nickName);
				// question.setMobile(phoneNumber);
				// UserInfo userinfo = UserInfoHandler.instance().getUserInfo(QuestionOnlineActivity.this);
				// userinfo.setMobile(phoneNumber);
				// if (nickName != null && !nickName.trim().equals("")) {
				// userinfo.setName(nickName);
				// }
				// UserInfoHandler.instance().saveUserInfo(QuestionOnlineActivity.this, userinfo);
				// question.setMobileModel(AppUtils.getMobileModel());
				// //question.setDate(userinfo.getLastTimeDate());
				// String result = QuestionHandler.instance().postQuestion(question, QuestionOnlineActivity.this);
				// data.putString(RESULT, result);
				// msg.setData(data);
				// handler.sendMessage(msg);

			} catch (Exception e) {
			}
		}
	}
}
